from config.dbs.reidsConfig import LOCATION
from celery.schedules import crontab

# 定义存放broker任务队列
broker_url = LOCATION % 3
# 定义存放结果
result_backend = LOCATION % 4

from celery.schedules import crontab

# Broker配置（根据你的实际配置调整）
broker_url = "redis://127.0.0.1:6379/1"
result_backend = "redis://127.0.0.1:6379/2"

# 任务序列化配置
task_serializer = 'json'
accept_content = ['json']
result_serializer = 'json'
timezone = "Asia/Shanghai"
worker_hijack_root_logger = False

# 定时任务配置
beat_schedule = {
    # 每30分钟检查一次超时订单
    'cancel-expired-orders': {
        'task': 'cancel_expired_orders_task',
        'schedule': crontab(minute='*/30'),  # 每30分钟执行一次
    },
}
